import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart';

class FileSelectService {
  static const MethodChannel _channel = MethodChannel('com.example.examapp/file_select');
  
  // 选择Excel文件
  static Future<File?> pickExcelFile() async {
    try {
      final String? path = await _channel.invokeMethod<String?>('pickExcelFile');
      if (path != null && path.isNotEmpty) {
        return File(path);
      }
      return null;
    } on PlatformException catch (e) {
      debugPrint('选择文件时出错: ${e.message}');
      return null;
    } catch (e) {
      debugPrint('选择文件时出错: $e');
      return null;
    }
  }
} 